<script>
import moment from 'moment';
export default {
  data() {
    return {
      selected: null,
      options: [],
      tags: null,
      allTag: [],
      tag_ids: [],
      startTime: {
        time: this.formDate()
      },
      option: {
        type: 'min',
        week: ['周一', '周二', '周三', '周四', '周五', '周六', '周日'],
        month: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'],
        format: 'YYYY-MM-DD HH:mm:ss',
        placeholder: 'Published At?',
        inputStyle: {
          'display': 'inline-block',
          'padding': '6px 6px 6px 10px',
          'height': '41px',
          'line-height': '22px',
          'font-size': '13px',
          'border': '1px solid #dce4ec',
          'border-radius': '6px',
          'color': '#5F5F5F'
        },
        color: {
          header: '#52697f',
          headerText: '#1abc9c'
        },
        buttons: {
          ok: 'Ok',
          cancel: 'Cancel'
        },
        overlayOpacity: 0.5,
        dismissible: true
      }
    }
  },
  mounted() {
    this.option.placeholder = this.$t('form.published_at')
  },
  created() {
    this.loadCategories()
    // this.loadTags()
  },
  methods: {
    formDate () {
      var dt = new Date();
      // if (!isNaN(value)) {
      //   dt.setTime(value * 1000);
      // }
      return moment(dt).format('YYYY-MM-DD HH:mm:ss');
    },
    loadCategories() {
      this.$http.get('categories')
        .then((response) => {
          this.options = response.data.data
        })
    },
    loadTags() {
      this.$http.get('tags')
        .then((response) => {
          this.allTag = response.data.data
        })
    },
  },
}
</script>
